<template>
  <eui-background type="common">
    <eui-navbar ref="EuiNavBar" :title="title" :storeName="sUserStoreName" :storeId="sUserStore" displayable="true" />
    <view class="top-view" v-if="c_master.c_status == '0'">
      <eui-search-bar ref="RdsSearchBar" v-model="searchText" placeholder="请输入商品条码、编码" leftIcon="icon-saoyisao"
                      @confirm="searchConfirm" radius="30"  :readonly="c_master.c_status !== '0'" />
    </view>
    <view class="footer-view" :style="{ height: listHeight + 'rpx' }">
      <scroll-view :scroll-top="scroolTop" scroll-y="true" style="height: 100%;">
       <view style="display:flex;flex-direction: column">
         <eui-card>
           <eui-card-input v-model="c_master.c_store_id" title="机构:" type="textname2" :name="getName('rdsStores', c_master.c_store_id)" :rightIconType="storeType !== '2' ? 'right' : ''"
                           ref="cardStoreInput" @iconClick="clickRight('c_store_id')" alignType="left" required="true" autoStyle="padding: 24rpx 0 24rpx 0"/>
           <eui-card-input v-model="c_master.c_adno" title="部门:" type="textname2" :name="getName('rdsDeparts', c_master.c_adno)" :rightIconType="!(c_detail.length > 0) ? 'right' : ''"
                           ref="cardAdnoInput" @iconClick="clickRight('c_adno')" alignType="left" required="true" autoStyle="padding: 24rpx 0 24rpx 0"/>
           <eui-card-input v-model="c_master.c_effect_da" title="生效日期:" type="date" placeholder="请选择生效日期" :displayable="(c_detail.length > 0)"
                           ref="effectDaInput" @input="effectDaChanged" alignType="left" required="true" autoStyle="padding: 24rpx 0 24rpx 0"/>
         </eui-card>
         <eui-card hPadding="28" v-if="c_detail && c_detail.length > 0">
           <eui-swipe-action>
             <view :ref="'dataItem' + index"  v-for="(item, index) in c_detail" :key="index">
               <eui-swipe-actionitem :ref="`swipeActionItem${index}`" :right-options="options" show="none" :auto-close="true"
                                     @change="change" @click="bindClick($event, index)" :disabled="c_master.c_status != '0'">
                 <view class="item-view">
                   <eui-text type="name2" :value="index + 1 + '. ' + item.c_gname" cWidth="width: 100%" />
                   <eui-text type="name2" :value="item.c_gcode" title="编码:" />
                   <eui-text type="name2" :value="item.c_distr_content + '/' + item.c_order_unit" title="包装/单位:" />
                   <eui-text type="name2" :value="item.c_barcode" title="条码:" />
                   <eui-text type="titlename2" :value="item.c_adno" :name="getRelatedName('rdsDeparts', item.c_adno)" title="部门:"></eui-text>
                   <eui-text type="number2" :value="item.c_dnlmt_number_orig" title="原最佳货位量:" />
                 </view>
                 <view class="line-view2" />
                 <eui-card-input v-model="item.c_dnlmt_number" autoStyle="padding: 0" title="新货位量:" type="number" :name="getRelatedName('rdsStores', item.c_store_id)"
                                 :ref="`cardAdvicePriceInput${index}`" placeholder="0" maxlength="4" alignType="left" required="true" :displayable="c_master.c_status !== '0'"
                                 @confirm="validateDetail('c_dnlmt_number', item.c_dnlmt_number, index) " showBottomLine="false" :isBlur="true" />
                 <eui-text v-model="JSON.parse(item.c_err_msg)[0].c_msg_err" type="name2" v-if="item.c_err_msg" title="错误:" cWidth="width: 100%;margin: 10rpx 0 10rpx 0" valueStyle="color: #FF4000;" />
               </eui-swipe-actionitem>
             </view>
           </eui-swipe-action>
         </eui-card>
       </view>
      </scroll-view>
    </view>
    <view class="bottom-view">
      <view class="center-style">
        <eui-button type="max" title="保存并审核" @buttonClick="buttonClick" :disabled="c_master.c_status !== '0' || c_detail.length <= 0"/>
      </view>
    </view>
  </eui-background>
</template>

<script setup type="ts">
import { ref, reactive, onMounted } from 'vue';
import {useMainStore} from "@/store/modules/store";
import {useLoginStore} from "@/store/modules/useLoginStore";
import { validateStores, validateGds, defaultMapping } from '@/hooks/useValidateMethod';
import {getRdsUrl, rdsRequest, rdsRequestAsync} from '@/hooks/rdsServices';
import { getRelatedName, getDictName } from '../components/RelatedName.js';
import service from "@/common/service";
import dateRangUtil from '../../../common/dateRangUtil';
import {onLoad} from "@dcloudio/uni-app";
import {init, getRdsUserDepartAuthority, getRdsSysConfig} from '@/hooks/init';
import { validateAdnoLevel } from '@/hooks/useBillInfo';
import { todayAdd, formatNow } from '@/hooks/useUtils';
import Enjoy from "@/common/enjoy";
const mainStore = useMainStore();
const LoginStore = useLoginStore();
const rdsUrl = getRdsUrl();
const show = ref(false);
const isOpened = ref('none');
const sUserStore = ref('');
const sUserStoreName = ref('');
const sUser = ref('');
const title = ref('新增');
const c_id = ref('');//单据号
const c_gcode = ref('');
const searchText = ref('');
const height = ref(0);
const width = ref(0);
const storeType = ref('2');//[0]总部 [1]分区总部 [2]分店 [3]配送中心
const c_status = ref('0');
const c_detail = ref([]);
const c_detail_orig = ref([]);
const newList = ref([]);
const modifiedList = ref([]);
const delList = ref([]);
const newListOrig = ref([]);
const modifiedListOrig = ref([]);
const currentGds = ref({});
const currentGdsIndex = ref(0);
const autoClose = ref(true);
const options = ref([{
  text: '删除',
  style: {
    backgroundColor: '#F56C6C',
  }
}]);
const sysConfig = ref({
  targetTrySale: true,//试销商品计算指标
  standardTrySale: true,//试销商品计算标准
});
let c_master = ref({
  c_tenant_id: '',
  c_id: '',
  c_bill_type: '061',
  c_status: '0',
  c_src_id: '',
  c_src_type: '',
  c_input_orig_mode: '1',
  c_store_id: sUserStore.value,
  c_store_name: sUserStoreName.value,
  c_value_mode: 'F',
  c_sample_code: sUserStore.value,
  c_sample_code_name: sUserStoreName.value,
  c_effect_da: todayAdd(0),
  c_adno: '',
  c_effect_fields_ctrl: '',
  c_effect_fields_order: '',
  c_effect_fields_opl: 'c_dnlmt_number',
  c_effect_fields_ts: '',
  c_effect_fields_wm: '',
  c_effect_fields_extend: '',
  c_apply_userno: sUser.value,
  c_buy_userno: '',
  c_charge_userno: '',
  c_org_no: '',
  c_store_style: '',
  c_mk_type: '3',
  c_mk_store_id: sUserStore.value,
  c_mk_store_name: sUserStoreName.value,
  c_mk_dt: dateRangUtil.formatDate(new Date(),'YYYY-MM-DD HH:mm:ss'),
  c_mk_userno: sUser.value,
  c_approve_status: '1',
  c_au_userno: '',
  c_print_n: 0,
  c_print_userno: '',
  c_note: '',
  c_sys_note: '',
});
const listHeight = ref(300);
const RdsSearchBar = ref(null);
const cardAdnoInput = ref(null);

onMounted(() => {
  getListHeight()
})

// 获取列表高度
const getListHeight = async () => {
  await uni.getSystemInfo({
    success: function (res) { // res - 各种参数
      let info = uni.createSelectorQuery().select(".footer-view");
      info.boundingClientRect(function (data) { //data - 各种参数
        //获取列表高度
        let height = res.windowHeight - data.top;
        //转换rpx
        listHeight.value = height / (res.windowWidth / 750) - 100;
      }).exec()
    }
  });
};

onLoad(async (option) => {
  await setDefault();
  await getSysConfig();
  sUserStore.value = option.storeId;
  if (option.billId) {
    c_id.value = option.billId;
    await billQuery();
  }
})

const dataListClass = (item) => {
  // 从 c_detail 查找当前扫描到的商品是否存在
  if (item.c_barcode == currentGds.value.c_barcode) {
    return `rds-count-input-content with-current-gds`;
  } else {
    return `rds-count-input-content`;
  }
}

const setDefault = async () => {
  const { loginInfo } = mainStore;
  sUserStore.value = loginInfo.sUserStore;
  sUserStoreName.value = loginInfo.sUserStoreName;
  sUser.value = loginInfo.sUser;
  c_master.value.c_store_id = sUserStore;
  c_master.value.c_mk_store_id = sUserStore;
  c_master.value.c_mk_userno = sUser;
  c_master.value.c_apply_userno = sUser;
  //验证部门层级
  if(!loginInfo.sCurrentAdno){
    return;
  }
  const result = await validateAdnoLevel({ IuputData: loginInfo.sCurrentAdno, billKind: "06", tenantId: loginInfo.idsToken.tenantid });
  if (result && !result.HasException) {
    const userAdno = await getRdsUserDepartAuthority();
    if (userAdno.includes(loginInfo.sCurrentAdno)) {
      c_master.value.c_adno = loginInfo.sCurrentAdno;
    }
  }
}

const getSysConfig = async () => {
  sysConfig.value.targetTrySale = await getRdsSysConfig('商品试销参数', '试销商品计算指标') === 'A';
  sysConfig.value.standardTrySale = await getRdsSysConfig('商品试销参数', '试销商品计算标准') === '1';
}

const searchConfirm = async (e) => {
  if (c_master.value.c_status != '0') {
    uni.showToast({
      duration: 3500,
      icon: 'none',
      title: '单据状态不是尚未审核'
    });
    return;
  }

  if (!c_master.value.c_adno) {
    uni.showToast({
      duration: 3500,
      icon: 'none',
      title: '请先录入部门！'
    });
    return;
  }
  searchText.value = e.value;
  const itemIndex = c_detail.value.findIndex(i => i.c_gcode == e.value || i.c_barcode == e.value);
  if (itemIndex !== -1) {
    const item = c_detail.value[itemIndex];
    currentGds.value = item;
    return true;
  } else {
    // TODO:如果缓存数据不存在，调用服务验证商品是否存在
    currentGds.value = initRow();
    let args = { fieldName: 'c_gcode', row: currentGds.value, newValue: searchText.value, };
    service.enjoyShowLoading('正在加载...');
    const result = await validateGds({
      url: rdsUrl.bcApi, uniqueKey: '商品分店信息变更单', billType: '061', args,
      head: {
        code: c_master.value.c_store_id.split(','),
        level: '1',
        value_mode: 'F',
        // sample_code: mainData.c_sample_code,
        adno: c_master.value.c_adno,
        login_store: sUserStore.value,
      },
      listManager: c_detail.value,
      mapping: [
        ...defaultMapping,
        ['c_adno', 'c_adno'],
        ['c_provider', 'c_provider'],
        ['c_barcode', 'c_barcode'],
        ['c_ctrlno', 'c_ctrlno'],
        ['c_price_sens', 'c_price_sens'],
        ['c_order_enlarge', 'c_order_enlarge'],
        ['c_order_content', 'c_order_content'],
        ['c_order_unit', 'c_order_unit'],
        ['c_distr_content', 'c_distr_content'],
        ['c_distr_unit', 'c_distr_unit'],
        ['c_unpack', 'c_unpack'],
        ['c_opl_prohibit', 'c_opl_prohibit'],
        ['c_dnlmt_day', 'c_dnlmt_day'],
        ['c_n_min_order', 'c_n_min_order'],
        ['c_dnlmt_number_orig', 'c_dnlmt_number'],
        ['c_n_min', 'c_n_min'],
        ['c_n_max', 'c_n_max'],
        ['c_property_group', 'c_property_group'],
        ['c_service_owner', 'c_service_owner'],
        ['c_label_type', 'c_label_type'],
        ...(!sysConfig.value.standardTrySale ? [] :
            [['c_test_days', 'c_test_days'],
              ['c_test_start_point', 'c_test_start_point'],
              ['c_test_sdate', 'c_test_sdate'],
              ...(sysConfig.value.targetTrySale ? [['c_plan_qty', 'c_plan_qty']] : [['c_plan_amt', 'c_plan_amt']]),
              ['c_plan_gross', 'c_plan_gross'],]),
        ['c_measurement_way', 'c_measurement_way'],
        ['c_measurement_type', 'c_measurement_type'],
        ['c_rec_processtype', 'c_rec_processtype'],
        ['c_extend1', 'c_extend1'],
        ['c_extend2', 'c_extend2'],
        ['c_extend3', 'c_extend3'],
        ['c_extend4', 'c_extend4'],
        ['c_extend5', 'c_extend5'],
        ['c_extend6', 'c_extend6'],
        ['c_extend7', 'c_extend7'],
        ['c_extend8', 'c_extend8'],
      ],
      detail: ['c_store_id'],
      allowRepeat: false,
    })
    service.enjoyHideLoading();
    if (result) {
      currentGds.value = result;
    }
    setTimeout(() => {
      RdsSearchBar.value.clear();
    }, 1000);
  }
}

// 选择框点击事件
const clickRight = (type) => {
  let parms = Enjoy.GetDialogParms();
  parms.CallBack = SelectionChanged;
  if (type=='c_store_id') {
    parms.SelectionType = "机构选择";
    parms.SelectedItems = c_master.value.c_store_id;
  } else if (type=='c_adno') {
    parms.SelectionType = "部门选择";
    parms.SelectedItems = c_master.value.c_adno;
  }
  Enjoy.OpenDialog(parms)
}

const SelectionChanged = async (e) =>{
  const { loginInfo } = mainStore;
  if (e.SelectionType=='机构选择') {
    let curStoreId = e.BackParms.Key;
    if (curStoreId.split(',').length == 1) {
      const result = await validateStores(
          { fieldName: 'c_store_id', row: c_master.value, newValue: curStoreId },
          { ischecklimit: true, firstValueMode: true }
      );
      storeType.value = result.c_type;
      sUserStoreName.value = e.BackParms.Value;
      sUserStore.value = curStoreId;
      c_master.value.c_mk_store_id = sUserStore.value;
      if (result.c_type === '2') {
        c_master.value.c_store_id = curStoreId;
      }
    } else {
      c_master.value.c_store_id = curStoreId;
    }
  } else if (e.SelectionType=='部门选择') {
    //验证部门层级
    let curAdno = e.BackParms.Key;
    const validateResult = await validateAdnoLevel({ IuputData: curAdno, billKind: "06", tenantId: loginInfo.idsToken.tenantid });
    if (validateResult.HasException) {
      uni.showToast({
        duration: 3500,
        icon: 'none',
        title: validateResult.Exception.Message
      });
      setTimeout(() => {
        clickRight('c_adno')
      }, 1000);
      return;
    }
    const userAdno = await getRdsUserDepartAuthority(sUser.value);
    if (userAdno.includes(curAdno)) {
      c_master.value.c_adno = curAdno;
    } else {
      uni.showToast({
        duration: 3500,
        icon: 'none',
        title: `没有部门${curAdno}权限！`
      });
      setTimeout(() => {
        clickRight('c_adno')
      }, 1000);
      return
    }

    const lsGds = c_detail.value.filter(i => i.c_gcode?.length > 0);
    if (lsGds.length > 0 && lsGds.some(i => i.c_adno.startsWith(curAdno) == false)) {
      uni.showToast({
        duration: 3500,
        icon: 'none',
        title: '录入部门与明细商品部门不匹配！'
      });
      setTimeout(() => {
        // this.$refs.cardAdnoInput.getFocus();
      }, 300);
      return;
    }

    // c_master.value.c_adno = e.BackParms.Key;
  }
}

const validateMain = async (t, e) => {
  switch (t) {
    case 'c_adno':
      if (!e) {
        uni.showToast({
          duration: 3500,
          icon: 'none',
          title: '部门不能为空'
        });
        cardAdnoInput.value.getFocus();
        return;
      }

      const lsGds = c_detail.value.filter(i => i.c_gcode?.length > 0);
      if (lsGds.length > 0 && lsGds.some(i => i.c_adno.startsWith(e) == false)) {
        uni.showToast({
          duration: 3000,
          icon: 'none',
          title: '录入部门与明细商品部门不匹配！'
        });
        return;
      }
      break;
  }
}

const validateDetail = async (t, e, index) => {
  currentGds.value = c_detail.value[index];
  switch (t) {
    case 'c_dnlmt_number':
      if (!e) {
        uni.showToast({
          duration: 3500,
          icon: 'none',
          title: '最佳货位量不能为空'
        });
        setTimeout(() => {
          // this.$refs[`cardAdvicePriceInput${index}`][0].getFocus();
        }, 300);
        return;
      }
      let newNumber = parseInt(e);
      currentGds.value.c_dnlmt_number = isNaN(newNumber) ? 0 : newNumber;
      currentGds.value.rowType = (currentGds.value.rowType === 1 || currentGds.value.rowType === undefined) ? 1 : 2;
      break;
  }
}

const buttonClick = (t) => {
  switch (t.type) {
    case 'max':
      uni.showModal({
        title: ' 提示',
        content: '您确定要保存并审核吗？',
        showCancel: true,
        success: (res) => {
          if (res.confirm) {
            saveBill();
          }
        }
      });
      break;
  }
}

// 获取单据详情信息
const billQuery = async () => {
  if (!c_id.value) {
    return;
  }
  service.enjoyShowLoading('正在加载...');
  const req = {
    BillId: c_id.value,
  };
  const result = await rdsRequest(rdsUrl.bcApi, '商品分店信息变更单', 'EnjoyBillQuery', req, '061');
  service.enjoyHideLoading();
  if (result.ds.length > 0) {
    c_master.value = result.ds[0];
    c_detail.value = result.ds1;

    c_detail.value.forEach(x => {
      x.c_dnlmt_number_orig = result.ds2.find(y => x.c_sort == y.c_sort && x.c_gcode == y.c_gcode)?.c_dnlmt_number || 0;
      x.rowType = 0;
    })
    title.value = c_master.value.c_id;
  } else {
    uni.showToast({
      duration: 3500,
      icon: 'none',
      title: '暂无数据',
      mask: true,
    });
  }
}

// 保存数据
const saveBill = async () => {
  if (c_detail.value.length <= 0) {
    uni.showToast({
      duration: 3500,
      icon: 'none',
      title: '请录入商品！'
    });
    return;
  }
  service.enjoyShowLoading('正在保存...');
  const flag = c_master.value.c_id;
  let reqBillId = c_master.value.c_id;
  if (!reqBillId) {
    const getBilllIdReq = {
      BillIdKeyValue: {
        key: "c_id",
        value: ""
      },
      BillVariable: "",
      TableName: "tb_mo_cgs",
      BillName: "商品分店信息变更单"
    }
    const billlId = await rdsRequest(rdsUrl.mainApi, '单号生成服务', 'EnjoyGetBillId', getBilllIdReq, '061');
    if (billlId) {
      reqBillId = billlId;
    } else {
      c_master.value.c_modify_userno = sUser.value;
      c_master.value.c_modify_dt = dateRangUtil.formatDate(new Date(),'YYYY-MM-DD HH:mm:ss');
    }
  }

  c_detail.value.forEach(x => x.c_id = reqBillId)
  newList.value = c_detail.value.filter(x => x.rowType == 1 || !x.hasOwnProperty('rowType'));
  modifiedList.value = c_detail.value.filter(x => x.rowType == 2);

  c_detail_orig.value = JSON.parse(JSON.stringify(c_detail.value));
  c_detail_orig.value.forEach(x => {
    x.c_dnlmt_number = Number(x.c_dnlmt_number_orig);
  });
  newListOrig.value = c_detail_orig.value.filter(x => x.rowType == 1 || !x.hasOwnProperty('rowType'));
  modifiedListOrig.value = c_detail_orig.value.filter(x => x.rowType == 2);

  const req = {
    NewList: flag ? [] : [c_master.value],
    ModifiedList: flag ? [c_master.value] : [],
    DelList: [],
    TableName: "tb_mo_cgs",
    PrimaryKeys: ["c_tenant_id", "c_id"],
    ChildData: [
      {
        ChildTableName: "tb_mo_cgs_g",
        ParentTableName: "tb_mo_cgs",
        ChildColumnNames: ["c_id"],
        ParentColumnNames: ["c_id"],
        ChildSaveModel: {
          NewList: newList.value,
          ModifiedList: modifiedList.value,
          DelList: [],
          TableName: "tb_mo_cgs_g",
          PrimaryKeys: ["c_tenant_id", "c_id", "c_sort"]
        },
      },
      {
        ChildTableName: "tb_mo_cgs_g_orig",
        ParentTableName: "tb_mo_cgs",
        ChildColumnNames: ["c_id"],
        ParentColumnNames: ["c_id"],
        ChildSaveModel: {
          NewList: newListOrig.value,
          ModifiedList: modifiedListOrig.value,
          DelList: [],
          TableName: "tb_mo_cgs_g_orig",
          PrimaryKeys: ["c_tenant_id", "c_id", "c_sort"],
        },
      }
    ],
    BillSet: {
      BillIdKeyValue: {
        key: "c_id",
        value: reqBillId
      },
      BillVariable: "",
      TableName: "tb_mo_cgs",
      BillName: "商品分店信息变更单"
    },
  };
  const result = await rdsRequest(rdsUrl.bcApi, '商品分店信息变更单', 'EnjoyBillSaveNew', req, '061');
  if (result.BillId) {
    c_id.value = reqBillId;
    c_master.value.c_id = reqBillId;
    const auditReq = {
      BillId: c_id.value,
      UserNo: sUser.value,
    }
    const auditResult = await rdsRequestAsync(rdsUrl.bcApi, '商品分店信息变更单', 'EnjoyBillAudit', auditReq, '061');
    if (auditResult.HasException) {
      uni.showToast({
        duration: 2000,
        icon: 'none',
        title: auditResult.Exception.Message
      });
      setTimeout(() => {
        billQuery();
      },2000);
      return
    }
  }
  service.enjoyHideLoading();
  uni.showToast({
    duration: 3500,
    icon: 'none',
    title: `操作成功`
  });
  let pages = getCurrentPages();
  let prevPage = pages[pages.length - 2];
  uni.navigateBack({
    delta: 1,
    success: () => {
      if (prevPage && prevPage.$vm) {
        setTimeout(() => {
          prevPage.$vm.$.exposed.getData();
        }, 500);
      } else {
        console.error('Error: Previous page or method not found.');
      }
    },
    fail: (error) => {
      console.error('Navigation failed:', error);
    }
  });
}

const getMCurrentPages = () => {
  setTimeout(() => {
    try {
      let pages = getCurrentPages(); //获取所有页面栈实例列表
      let prevPage = pages[pages.length - 2]; //上一页页面实例
      prevPage.$vm.getData(); //执行函数也是同理
    } catch (e) { }
    try {
      let pages = getCurrentPages(); //获取所有页面栈实例列表
      let prevTwoPage = pages[pages.length - 3]; //上两个页页面实例
      prevTwoPage.$vm.getData(); //执行函数也是同理
    } catch (e) { }
  }, 500)
}

const getName = (key, value) => {
  if (!value) {
    return ''
  }
  let list = [];
  value.split(',').map(item => {
    list.push("[" + item + "]" + (getRelatedName(key, item) || key));
  })
  return list.join(',');
}

// 录入列表的相同商品的index
const sameGdsIndex = (item) => {
  return c_detail.value.findIndex(i => i.c_barcode == item.c_barcode);
}

const effectDaChanged = (value) => {
  let nowDate = formatNow('YYYY-MM-DD');
  if (value < nowDate) {
    uni.showToast({
      duration: 3500,
      icon: 'none',
      title: '生效日期不可早于今天,请检查！'
    })
    setTimeout(() => {
      c_master.value.c_effect_da = nowDate;
    },200)
    return;
  }
}

const change = (e) => {
  isOpened.value = e;
}

const bindClick = (e, index) => {
  uni.showModal({
    title: ' 提示',
    content: '您确定要删除数据吗？',
    showCancel: true,
    success: async (res) => {
      if (res.confirm) {
        c_detail.value.splice(index, 1);
      }
    }
  });
}

const initRow = () => {
  return {
    c_tenant_id: '',
    c_id: '',
    c_sort: c_detail.value.length + 1,
    c_gcode: '',
    c_gname: '',
    c_barcode: '',
    c_store_id: '',
    c_store_name: sUserStoreName.value,
    // c_store_name_en: defaultStoreNameEn,
    c_adno: '',
    c_provider: '',
    c_ctrlno: '',
    c_price_sens: '',
    c_order_enlarge: 1,
    c_order_content: 0,
    c_order_unit: '',
    c_distr_content: 0,
    c_distr_unit: '',
    c_unpack: '',
    c_opl_prohibit: '',
    c_dnlmt_day: 0,
    c_n_min_order: 0,
    c_dnlmt_number: 0,
    c_dnlmt_number_orig: 0,
    c_n_min: 0,
    c_n_max: 0,
    c_property_group: '',
    c_service_owner: '',
    c_label_type: '',
    c_price_note: '',
    c_test_days: 0,
    c_test_start_point: '',
    c_plan_qty: 0,
    c_plan_amt: 0,
    c_plan_gross: 0,
    c_measurement_way: '',
    c_measurement_type: '',
    c_rec_processtype: '',
    c_extend1: null,
    c_extend2: null,
    c_extend3: '',
    c_extend4: '',
    c_extend5: '',
    c_extend6: '',
    c_extend7: '',
    c_extend8: '',
    c_note: '',
    c_err_msg: '',
    rowType: 1,
  }
}

const confirm = (type, val) => {
  console.log(type, val);
}

</script>

<style lang="scss" scoped>
@import '../../../main.scss';
.navigation {
  display: flex;
  height: 100vh;
  width: 100%;
  flex-direction: column;
  background: #F2F2F2;
}
.top-view {
  width: 100%;
  height: 88rpx;
}
.footer-view {
  width: 100%;
  flex: 1;
}
.center-style {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  margin-right: 20rpx;
}
.bottom-view {
  width: 100%;
  height: 100rpx;
  background: #FFFFFF;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-direction: row;
}
.test-view {
  width: 100%;
  height: 88rpx;
  background: #FFFFFF;
}

// 列表展示项自定义样式
.rds-count-input-content {
  background-color: #ffffff;
  margin: 0 5rpx 1rpx 5rpx;
  padding: 5rpx;
}

.rds-count-input-content:last-child {
  margin-bottom: 180rpx; // 保持和底部一定的距离
}

// 当前扫描到的商品
.with-current-gds {
  background-color: #FDFFC2E0;
}

//内容行
.item-view {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
  margin-top: 16rpx;
  row-gap: 8rpx;
}
.line-view {
  width: 100%;
  height: 1rpx;
  background: #EEEEEE;
  margin: 20rpx 0;
}
.line-view2 {
  width: 100%;
  height: 1rpx;
  background: #EEEEEE;
  margin: 20rpx 0 0 0;
}
</style>
